package com.gx;

import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author lpj
 */
@SpringBootApplication
@Slf4j
@EnableTransactionManagement
@EnableEncryptableProperties
public class FlowableModuleApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(FlowableModuleApplication.class, args);
        ConfigurableEnvironment environment = applicationContext.getEnvironment();
        String ipAddress = "127.0.0.1";
        try {
            ipAddress = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        String port = environment.getProperty("server.port");
        String contextPath = environment.getProperty("server.servlet.context-path");
        String active = environment.getProperty("spring.profiles.active");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application is running! Access URLs:\n\t" +
                "Doc: \t\thttp://" + ipAddress + ":" + port + contextPath + "doc.html\n\t" +
                "spring-profiles-active: \t\t" + active + "\n\t" +
                "Auth: \t\t" + "Liupj" + "\n\t" +
                "----------------------------------------------------------");
    }

}
